package com.learn.controller;

import com.learn.service.HelloService;
import com.learn.service.TestService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

/**
 * @program: springmvc
 * @description:
 * @author: zjj
 * @create: 2020-04-16 10:08
 **/
@Controller
@RequestMapping("/hello")
@Slf4j
public class HelloController {
    @Resource
    private HelloService helloService;
    @Resource(name = "testService")
    private TestService testService;
    @RequestMapping(value = "/test",method = RequestMethod.GET)
    public ModelAndView test() {
        log.debug("..............start");
        helloService.add();
        testService.test();
        ModelAndView modelAndView=new ModelAndView();
        modelAndView.addObject("name","zhangsan");
        modelAndView.setViewName("hello");
        log.debug("..............end");
        return modelAndView;
    }
}
